<?php
/**
 * Created by PhpStorm.
 * User: hcadmin
 * Date: 16/8/18
 * Time: 下午12:01
 */
require_once '../MMysql.php';

//  $page= $_POST['limit'];
//  $rows= $_POST['offset'];

  $mysql = new MMysql();
  $res = $mysql
    //->where(array('city_id'=>array('3','>','and')))
    ->limit(1,10)
    ->select('property');
$arraya=Array();
foreach ($res as $u){
    
     $u["likes"]=$mysql->where(array('property_id'=> $u["property_id"]))->count('likes');
//     $mysql->count('likes');
     $arraya[]=$u;
}

$count=$mysql->count('property');

//echo json_encode($count);
$array=Array();
$array["rows"]=$arraya;
$array["total"]=$count;
echo  json_encode($array);